#include <iostream>

using namespace std;

template < class T >
class Array
{
private:
	enum { size = 100 };
	T A[size];
public:
	T & operator []( int index );
	T & test( void );
};

template < class T >
T & Array< T >::operator[]( int index )
{
	if( index < 0 || index >= size )
		cout << "Index out of range." << endl;
	return A[index];
}

template < class T >
T &Array< T >::test( void )
{
	return A[0];
}

int main()
{
	Array< int > ia;
	ia[3] = 2;
	cout << ia[3] << endl;

	ia.test() = 10;
	cout << ia.test() << endl;
}

/// thinking in c++ P394
